// Learn TypeScript:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/typescript.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class appConfig{

    /*
        游戏相关信息
    */
    private static platform : number = 1;
    private static game_name : string = "勇者传说";
    private static version : string = "game"; // test game

    /*
        是否是新用户
    */
    private static newUser = true;

    /*
        新用户体力点数
    */
    private static newUserPower = 5;

    /*
        体力最大值
    */
    private static powerLimit = 5;

    /*
        体力回复值
    */
    private static powerRecover = 3;

    /*
        关卡等级区间
    */
    public static levelRankLayer = [1,14,32];


    //获取当前游戏版本信息
    public static gameInfor(){
        return this.game_name + "_" + this.version;
    }

    //游戏的平台
    public static gamePlatform(){
        if (cc.sys.isMobile) {
            if (cc.sys.OS_ANDROID) {
                this.platform = 1;
            } else if (cc.sys.OS_IOS) {
                this.platform = 1;
            }
        } else if (cc.sys.isBrowser) {
            this.platform = 0;
        } else {
            this.platform = 1;
            console.log("运行在其他平台");
        }
        return this.platform;
    }

    public static setUserType(value){
        this.newUser = value;
    }

    public static getUserType(){
        return this.newUser;
    }

    public static getPowerLimit(){
        return this.powerLimit;
    }

    public static getPowerRecover(){
        return this.powerRecover;
    }

    public static getInitPower(){
        return this.newUserPower;
    }
}
